pad encryption method and software

ABSTRACT

A pad encryption software architecture includes space on a floppy for storing the pad to be used with the encryption software. The pad is XOR generated with random numbers subject to redetermined offsets. If the pad is smaller than the text to be encrypted, then XOR takes several cycles with redetermined offsets used in XORing the pad with the remaining plain text to be encrypted. The offset is determined from a user selected password. New offsets are determined from old offsets by adding the current offset to the value of the byte in the pad located at the offset value.

FIELD OF INVENTION

This invention relates generally to encryption methods and software, and more particularly to stream ciphers and one time pad encryption methods and software.

BACKGROUND OF THE INVENTION

One time pad encryption methods are well known. The first such method was invented in 1917 by Major Joseph Mauborgne and AT&T's Gilbert Vernam. Classically, a one time pad is a key of random letters, written on sheets of paper bound together in a pad. The pad is used to encrypt plain text and to decrypt the encrypted ciphertext. The pad is kept secret, and can be referred to as a private key. For security, the pad has the same or more letters than the message being encrypted. Accordingly, the pad is cumbersome, because it requires a large number of letters.

A one time pad provides perfect encryption, provided the letters of the pad are truly random. However, the burden of using a pad which is the same or a greater size than the text being encrypted makes one time pad methods generally non-applicable to consumer uses.

Encryption becomes less than perfect, if the key is less than perfectly random.

It would be beneficial to have a one time pad method which employs less random letters than the size of the message being encrypted.

It would be beneficial to enhance the security of one time pad methods which rely upon less than perfectly random, i.e., pseudo random, pads.

SUMMARY OF THE INVENTION

According to the present invention, characters for a pad are generated by selecting a seed file, extracting a first value from the seed file, generating a random number, and logically combining the first value with the random number to generate a first random character of the pad. To generate a next random character of the pad, a next value is extracted from the selected seed file, a next random number is generated, and the next random number is combined logically with the next value from the selected seed file to generate a next random character of the pad. This process repeats itself until a desired number of pad characters have been developed.

According to an embodiment of the present invention, logical combination by exclusive OR, i.e., XOR, is performed to generate a first random character. According to an embodiment of the present invention, a pad is produced having on the order of approximately 20,000 random characters.

According to the present invention, a user selects plain text to be encrypted and XORs the plain text with a pad at determined offset, to produce output cipher text. If the plain text is larger in number of characters than the pad, the pad is reused at a redetermined offset for XORing the not yet enciphered portions of the plain text. According to one embodiment of the present invention, the offset is a function of a user selected password. According to one embodiment of the present invention, the pad includes the user selected password or a derivative thereof.

According to the present invention, a pad is created with a software program stored on a selected memory medium a which space is reserved for storage of the pad created. Once the pad is created, it is stored at the reserved space. According to one embodiment of the present invention, the pad is additionally stored at another location for security. According to one embodiment of the present invention, the pad is stored on a flash card. According to one embodiment of the present invention, the software program is stored on a floppy disk. According to one embodiment of the present invention, the pad is stored at a reserved space on the floppy disk. According to one embodiment of the present invention, the software program is installed on a hard disk. According to one embodiment of the present invention, the pad is created by the software program with a seed file located on a hard disk drive, i.e., a hard drive.

DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flow diagram of a method according to the present invention, showing creation of a pad with a seed file and storage of the pad created on a flash card and at a blank space on a floppy disk carrying a software program creating the pad;

FIG. 2 is a flow diagram of a method according to the present invention, showing creation of a random character by XORing pseudo random numbers with corresponding characters of a selected seed file;

FIG. 3 is a flow diagram of a method according to the present invention, showing the determination of an offset applied to the pad before XORing with a corresponding character of plain text to be encrypted;

FIG. 4 is a flow diagram of a method according to the present invention, showing user selection of plain text and a password for encryption, and calculation of a pad offset for establishing character correspondence between plain text and pad prior to XORing to determine ciphertext; and

FIG. 5 is a flow diagram of a method according to the present invention, showing creation of ciphertext by XORing with the result of a pad XORed at an offset location with a selected password, the offset itself being a function of the selected password.

DESCRIPTION OF THE PREFERRED EMBODIMENT

FIG. 1 is a flow diagram of a method according to the present invention, showing installation 10 of a software pad and encryption program having blank spaces for storage of a pad sequence to be generated by running the pad & encryption program, as will be discussed in detail below. In particular, the program is operated from an external storage source such as for example a floppy, a PCMCIA card, or a PC card. Utilities such as compression and help programs can be installed from the external storage source to a hard disk for operation with the external storage source. An example of one such utility program according to the present invention is shown in the appendixes attached hereto.

According to one embodiment of the present invention, operation of the pad & encryption program according to the invention is done on a personal computer (PC). The pad & encryption program according to an embodiment of the present invention, is originally stored on a floppy disk. Space is reserved on the floppy disk for storage of the pad which is generated. A seed file is identified 12 on the hard drive.

A random pad is created 13 by XORing pseudo random numbers with the seed file located on the hard drive on which the pad & encryption program is installed, according to one embodiment of the present invention. A seed file can be an arbitrary or selected text or non-text file on the hard drive of a personal computer which is randomly or purposefully selected for XOR processing with the pad. A purely random pad is typically not feasibly obtained from computer operation, in view of the regularity of computer operation. However, a computer can generate pseudo random numbers, as is well known. Accordingly, random pad can feasibly be established by computer operation in conjunction with an external source--in this case the user supplied seed file.

Exclusive OR operation can be performed as follows, with the following first and second bytes:

    ______________________________________                                                   BYTE ONE = 10100100                                                            BYTE TWO = 11001110                                                            XOR = 01101010                                                       ______________________________________                                    

In short, any bit match between the two bytes yields FALSE, any bit mismatch yields TRUE.

The XOR operation can be undone in two ways, to regenerate BYTE ONE, or BYTE TWO, as desired. In particular, BYTE ONE is regenerated by XORing the first XOR result with BYTE TWO, as follows:

    ______________________________________                                                   XOR = 01101010                                                                 BYTE TWO = 11001110                                                            BYTE ONE = 10100100                                                  ______________________________________                                    

Similarly, BYTE TWO is regenerated by XORing the first XOR result with BYTE ONE, as follows:

    ______________________________________                                                   XOR = 01101010                                                                 BYTE ONE = 10100100                                                            BYTE TWO = 11001110                                                  ______________________________________                                    

The random pad created is stored 14 at the blank space on the floppy disk or other storage location selected, according to an embodiment of the present invention. The random pad which has been created can additionally be stored 14 on a flash card which has been prepared by burning a PCMCIA program onto it, according to an embodiment of the present invention. According to the present invention, once encryption has been completed and the encrypted text has been stored on a hard disk on a computer or elsewhere, the pad number or sequence must be separated from the encrypted number. If the pad number or sequence is stored proximally to the encrypted text, there is no security for the encrypted text, because a third party having access to the encrypted text also can use the pad to decrypt the encrypted text. Having the pad on a PCMCIA card, a medium which is non-volatile and more robust than the typical floppy disk, permit the encrypting user to separately maintain the encrypted text and the key, i.e., the pad, which can be used to access the encrypted text. Typically, it is desired to have a back-up for the pad stored on the PCMCIA card. Accordingly, it is one embodiment of the present invention to store the pad at a predetermined location within the pad & encryption program, preferably on the installation disk used to install the pad & encryption program on the PC hard drive for operation, including generation of a pad. According to one embodiment of the present invention, the pad & encryption program is mounted on a selected memory medium, which may be magnetic or optical. According to one embodiment, the pad & encryption program is stored on a magnetic floppy disk and is installable on a magnetic hard drive. According to one embodiment, the pad & encryption program includes software modules including but not limited to a pad creation module, an encryption module, an installation module, and an initially blank or zeroed pad sequence storage module or region.

FIG. 2 is a flow diagram of a method according to the present invention, showing creation of successive random characters by XORing pseudo random numbers with corresponding characters of a selected seed file. In particular according to the present invention, characters for a pad are generated by selecting a seed file and entering 20 the seed file at a first byte thereof. A seed file is any selected file containing elements, bits, values, or characters. It is called the "seed file" for convenience herein, because it is the file from which bits for example are obtained which after a particular logical operation give birth to the desired pad which is used for encryption purposes according to the present invention. The first byte is stored 21 in a memory (e.g., RAM memory) momentarily, serving as a first value from the seed file. Further, a pseudo random number is generated 23, and the pseudo random number is logically combined, by exclusive OR, i.e., XOR, operation, with the first value extracted from the seed file, to generate a first random character of the pad. To generate a next random character of the pad, the process of FIG. 2 is repeated, and successive values, e.g., bytes, are extracted from the selected seed file for logical combination with successively generated pseudo random numbers. Each pseudo random number is generated in succession, and each next pseudo random number is combined logically with the next value from the selected seed file to generate a next random character of the pad. This process repeats itself until a desired number of pad characters have been developed or produced. For purposes of this invention, created, produced and generated have the same meaning. According to an embodiment of the present invention, logical combination by exclusive OR, i.e., XOR, is performed to generate the random characters of the pad. According to an embodiment of the present invention, the pad produced can have on the order of approximately 20,000 random characters. According to an embodiment of the present invention, random number generation produces pseudo random numbers by pseudo random number generation.

FIG. 3 is a flow diagram of a method according to the present invention, showing the determination of an offset or setoff applied to the pad before XORing with a corresponding character of plain text to be encrypted. According to one embodiment of the present invention, the offset determines which character of a pad string will correspond with a counterpart character of plain text during XOR operation, to raise the security level of encryption. Thus, for a zero offset, the first character of a pad string will be XORed with the first character of plain text to be encrypted. A second character of a pad string will be XORed with the second character of plain text to be encrypted and so on.

With an initial setoff of two, on the other hand, the third character of a pad string will be XORed with the first character of plain text to be encrypted. A fourth character of a pad string will be XORed with the second character of plain text to be encrypted and so on.

The beneficial use in enhancing security of plain text to be encrypted with the use of a changed pad setoff arises from the fact that to avoid susceptibility of the encrypted text to undesired decryption, the pad must be as long as the plain text to be decrypted. If the plain text is longer than the pad, security requires that a new pad be used, otherwise the encryption can be broken, by relying upon the establishment of a pattern with reuse of the same pad for the remainder of the plain text left over after the first portion has been encrypted with the pad. According to the present invention, this disadvantage is avoided by using a first pad setoff for encryption of a first portion of the plain text being encrypted and a second, independent pad setoff for another portion of the plain text, which is left over after the first portion has been encrypted.

According to the present invention, XOR logical conversion of a particular pad generated and plain text selected for a first encryption level is performed 30 with a first offset. A new offset can be determined 31 by adding the value of an older offset with a selected non-negative integer value derived from the pad 32 relative to the older offset valve, and applying the offset to determine the pad characters to be XORed with further plain text characters. Accordingly, in order to continue first level encryption with the remainder of the plain text, one enters the pad at the location specified by the new offset valve. For subsequent offsets in further cycles, the process is repeated.

Thus, according to one embodiment of the present invention, the offset can be redetermined for each cycle in accordance with the flow chart of FIG. 3. A cycle is defined as the point when a pad string has been completely used in XOR operation to perform a first order encryption of a portion of a plain text file. For example, if the pad string contains n characters or bytes, and the offset is 5, then the first character of the plain text is logically combined with a character from the pad defined by the offset 5. The characters initially skipped can be eliminated entirely from use, according to one embodiment, or they can be used at the end of a particular cycle.

FIG. 4 is a flow diagram of a method according to the present invention, showing user selection 40 of plain text and a password for encryption. FIG. 4 further shows calculation of an offset from the selected password for establishing character correspondence between plain text and pad prior to XORing 42 (byte-sized, according to one embodiment of the present invention) plain text characters, to generate desired output ciphertext. The offset is significant, because the plain text is a file of sequential characters. Similarly, the pad is a sequential grouping of bits or characters. According to the present invention, an initial offset is established by establishing a correspondence at an initial offset value of the pad sequence which will be XORed with the first character of the plain text. According to the present invention, a user selects 40 plain text to be encrypted 41 and selects 44 a password of desired length. According to one embodiment of the present invention, a five character password is selected.

According to one embodiment of the present invention, selecting 41 plain text to be encrypted includes or is followed by compressing the plain text by a selected compression technique. Many compression techniques are well-known. Some of these are commercially available. Any one of these may be used in connection with the present invention. Alternatively, compression can be applied to the output ciphertext, within the meaning of the present invention.

Next in FIG. 4, the user XORs 42 particular characters, i.e., bytes, of the selected plain text with corresponding pad characters or pad derivative (e.g., the pad XORed with a password) characters. The pad characters XORed are taken from a pad of selected relative size (compared to the size of the plain text being XORed) at a determined pad character offset. The result of XORing the offset pad characters with corresponding plain text characters is to produce output cipher text.

According to one embodiment of the invention, the offset at which pad characters are taken for XORing with corresponding plain text, can be determined by selecting a password which may have five characters, for example, and programming 44 the selected password by combination with a randomly determined pad. The offset is determined 45 with reference to the selected password.

An example of how to determine the offset from a selected password is according to the following code:

char code;

int offset;

int y;

for (y=0; y<5;y++) do

offset +=*(code+y);

The character of the pad to be selected in accordance with the offset is identified by moving 46 a pointer for example to the location of the next character in the pad. Next, the character of the pad identified with reference to the offset is extracted 47 and then XORed with the password 43. Finally, the result of XOR logical combination 43 is XORed with corresponding plain text 42 to produce output ciphertext.

If the plain text is larger in number of characters than the pad, the pad is reused at a redetermined offset for XORing the not yet enciphered portions of the plain text. According to one embodiment of the present invention, the offset is a function of a user selected password. According to one embodiment of the present invention, the pad includes the user selected password or a derivative thereof.

According to the present invention, a pad is created with a software program stored on a selected memory medium on which space is reserved for storage of the pad created. Once the pad is created, it is stored at the reserved space. According to one embodiment of the present invention, the pad is additionally stored at another location for security. According to one embodiment of the present invention, the pad is stored on a flash card. According to one embodiment of the present invention, the software program is stored on a floppy disk. According to one embodiment of the present invention, the pad is stored at a reserved space on the floppy disk. According to one embodiment of the present invention, the software program is installed on a hard disk. According to one embodiment of the present invention, the pad is created by the software program with a seed file located on a hard disk drive, i.e., a hard drive.

FIG. 5 is a flow diagram of a method according to the present invention, showing creation of ciphertext by XORing with the result of a pad XORed at an offset location with a selected password, the offset itself being a function of the selected password. In particular, a password is selected 50. Next, an offset is calculated 51 or otherwise determined. A move is then made 52 to the offset determined location. Then, the character of the pad at the offset location is extracted 53. The particular pad character is XORed 54 with the first character of the password, to produce a result, which in turn is XORed 55 with corresponding characters of plain text to produce ciphertext.

For purposes of the present invention, random is defined as an unpatterned, probabilistically unbiased sequence greater than or equal to one of elements (preferably bits, but for example also characters or numbers). Pseudo random means substantially but not completely random, for example but not limited to 99 percent random. By definition, a computer generated number is considered to be pseudo random.

Appendix A. below provides an example of C++ code according to an embodiment of the present invention. ##SPC1##

Appendix B. below provides an example of C++ code according to the present invention. ##SPC2##

Appendix C. below provides an example of C++ code according to the present invention. ##SPC3##

Appendix D. below provides an example of C++ code according to the present invention. ##SPC4## 

What is claimed is:
 1. A method of generating a pad from a selected file stored in computer memory, comprising:extracting a first value from a selected file stored in a computer memory, generating a pseudo random number, logically combining the first value with the pseudo random number to generate a first random character of a pad, and successively repeating the prior steps to produce next random characters of a pad.
 2. The method according to claim 1, wherein logically combining includes performing an XOR operation.
 3. The method of claim 1 further comprising choosing the selected file from one of a plurality of files stored in computer memory before extracting a first value.
 4. The method of claim 3 wherein logically combining includes performing an XOR operation.
 5. An encryption method comprising:logically combining characters of a selected character file in a computer memory with random numbers to produce elements of a pad of predetermined dimension, and logically combining characters of plain text with corresponding elements of the pad.
 6. The encryption method of claim 5, wherein the predetermined dimension of the pad is greater than the number of characters of plain text being combined logically.
 7. The encryption method of claim 5, wherein the predetermined dimension of the pad is less than the number of characters of plain text being combined logically.
 8. The encryption method of claim 5, wherein the corresponding characters of the pad are determined subject to an offset.
 9. The encryption method of claim 5 further comprising choosing the selected character file in a computer memory from one of a plurality of character files in the computer memory before logically combining characters of a selected character file.
 10. The encryption method of claim 9, wherein the dimension of the pad is greater than the number of characters of plain text being combined logically.
 11. The encryption method of claim 9, wherein the dimension of the pad is less than the number of characters of plain text being combined logically.
 12. The encryption method of claim 9, wherein the corresponding characters of the pad are determined subject to an offset.
 13. An encryption method comprising:logically combining characters of a selected character file in computer memory with corresponding random numbers to produce a pad of predetermined dimension, and logically combining characters of plain text with corresponding elements of the pad, wherein the corresponding characters of the pad are determined subject to an offset, and wherein the offset is a function of a selected password.
 14. A method for operation on a computer, comprising:installing an encryption program from an external storage source, selecting a seed file, and exclusive ORing pseudo random numbers with characters from the seed file to generate a pad.
 15. The method according to claim 14 wherein the pad is stored on a floppy disk.
 16. The method according to claim 14 wherein the pad is stored on a flash memory. 